import { Component, PropsWithChildren } from "react";
import { View, Button } from "@tarojs/components";
import "./index.less";
import { DateTimePicker } from "../../components/DateTimePicker/DateTimePicker";

interface State {
  flag: boolean;
}

export default class Index extends Component<PropsWithChildren> {
  public state: State = {
    flag: true
  };

  changeLang() {
    this.setState({ flag: !this.state.flag });
  }

  render() {
    const cg = (str: string) => {
      console.log(str);
    };
    return (
      <View className='index'>
        <Button onClick={() => this.changeLang()}>切换语言</Button>
        <DateTimePicker
          onChange={cg}
          format='YYYY年MM月DD日 hh时mm分ss秒'
          lang={this.state.flag ? { confirm: "confirm" } : undefined}
        ></DateTimePicker>
      </View>
    );
  }
}
